package com.itheima.stock.controller;

import com.itheima.stock.domain.StockWeekKDomain;
import com.itheima.stock.pojo.dto.StockScreenSecond;
import com.itheima.stock.service.StockRtInfoService;
import com.itheima.stock.vo.resp.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;

/**
 * 个股详情信息表(StockRtInfo)表控制层
 *
 * @author GuoXinChao.126@gmail.com
 * @since 2023-03-04 19:50:46
 */
@RestController
@RequestMapping
public class StockRtInfoController {
    /**
     * 服务对象
     */
    @Resource
    private StockRtInfoService stockRtInfoService;


    /**
     * 个股秒级行情数据查询
     * @param code
     * @return
     */
    @GetMapping(path = "/api/quot/stock/screen/second")
    public R getSecond(String code){
        StockScreenSecond stockScreenSecond =  stockRtInfoService.selectSecond(code);

        return R.ok(stockScreenSecond);
    }

    @GetMapping(path = "/api/quot/stock/screen/weekkline")
    public R<List<StockWeekKDomain>> getWeekK(String code) throws ParseException {
        System.out.println(code);
        R<List<StockWeekKDomain>> list =stockRtInfoService.getWeekK(code);
//        System.out.println(list.getData());
        return list;
    }

}

